package cineplanet.modelo;

import java.io.Serializable;
import java.util.*;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;


/**
 * The persistent class for the pelicula database table.
 * 
 */
@Entity
@Table(name="pelicula")
@NamedQueries({@NamedQuery(name = "Pelicula.findAll", query = "SELECT pe FROM Pelicula pe"),
	@NamedQuery(name = "Pelicula.findByIdPelicula", query = "SELECT pe FROM Pelicula pe WHERE pe.idPelicula = :idPelicula"),
	@NamedQuery(name = "Pelicula.findByTitulo", query = "SELECT pe FROM Pelicula pe WHERE pe.titulo = :titulo"),
	@NamedQuery(name = "Pelicula.findByGenero", query = "SELECT pe FROM Pelicula pe WHERE pe.genero = :genero"),
	@NamedQuery(name = "Pelicula.findByDuracion", query = "SELECT pe FROM Pelicula pe WHERE pe.duracion = :duracion"),
	@NamedQuery(name = "Pelicula.findByPais", query = "SELECT pe FROM Pelicula pe WHERE pe.pais = :pais"),
	@NamedQuery(name = "Pelicula.findByDirector", query = "SELECT pe FROM Pelicula pe WHERE pe.director = :director"),
	@NamedQuery(name = "Pelicula.findByActores", query = "SELECT pe FROM Pelicula pe WHERE pe.actores = :actores"),
	@NamedQuery(name = "Pelicula.findByCensura", query = "SELECT pe FROM Pelicula pe WHERE pe.censura = :censura"),
	@NamedQuery(name = "Pelicula.findByWeb", query = "SELECT pe FROM Pelicula pe WHERE pe.web = :web"),
	@NamedQuery(name = "Pelicula.findBySinopsis", query = "SELECT pe FROM Pelicula pe WHERE pe.sinopsis = :sinopsis"),
	@NamedQuery(name = "Pelicula.findByTresd", query = "SELECT pe FROM Pelicula pe WHERE pe.tresd = :tresd"),
	@NamedQuery(name = "Pelicula.findByEstreno", query = "SELECT pe FROM Pelicula pe WHERE pe.estreno = :estreno"),
	@NamedQuery(name = "Pelicula.findByEstado", query = "SELECT pe FROM Pelicula pe WHERE pe.estado = :estado"),
	@NamedQuery(name = "Pelicula.findByPortada", query = "SELECT pe FROM Pelicula pe WHERE pe.portada = :portada"),
	@NamedQuery(name = "Pelicula.findByTipoProyeccion", query = "SELECT pe FROM Pelicula pe WHERE pe.tipoProyeccion = :tipoProyeccion")
})
public class Pelicula implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idPelicula")
	private Integer idPelicula;
    @Lob()
    @Column(name = "actores")
	private String actores;
    @Column(name = "censura")
	private String censura;
    @Column(name = "director")
	private String director;
    @Column(name = "duracion")
	private String duracion;
    @Column(name = "estado")
	private byte estado;
    @Column(name = "estreno")
	private byte estreno;
    @Column(name = "genero")
	private String genero;
    @Column(name = "pais")
	private String pais;
    @Column(name = "portada")
	private byte portada;
    @Lob()
    @Column(name = "sinopsis")
	private String sinopsis;
    @Column(name = "tipoProyeccion")
	private String tipoProyeccion;
    @Column(name = "titulo")
	private String titulo;
    @Column(name = "tresd")
	private byte tresd;
    @Column(name = "web")
	private String web;

	//bi-directional many-to-one association to Horario
//	@OneToMany(mappedBy="pelicula")
//	private Set<Horario> horarios;
//	
	@OneToMany(cascade = CascadeType.ALL, mappedBy = "idPelicula")
	private Collection<Horario> horarioCollection;

    public Pelicula() {
    }

	public int getIdPelicula() {
		return this.idPelicula;
	}

	public void setIdPelicula(int idPelicula) {
		this.idPelicula = idPelicula;
	}

	public String getActores() {
		return this.actores;
	}

	public void setActores(String actores) {
		this.actores = actores;
	}

	public String getCensura() {
		return this.censura;
	}

	public void setCensura(String censura) {
		this.censura = censura;
	}

	public String getDirector() {
		return this.director;
	}

	public void setDirector(String director) {
		this.director = director;
	}

	public String getDuracion() {
		return this.duracion;
	}

	public void setDuracion(String duracion) {
		this.duracion = duracion;
	}

	public byte getEstado() {
		return this.estado;
	}

	public void setEstado(byte estado) {
		this.estado = estado;
	}

	public byte getEstreno() {
		return this.estreno;
	}

	public void setEstreno(byte estreno) {
		this.estreno = estreno;
	}

	public String getGenero() {
		return this.genero;
	}

	public void setGenero(String genero) {
		this.genero = genero;
	}

	public String getPais() {
		return this.pais;
	}

	public void setPais(String pais) {
		this.pais = pais;
	}

	public byte getPortada() {
		return this.portada;
	}

	public void setPortada(byte portada) {
		this.portada = portada;
	}

	public String getSinopsis() {
		return this.sinopsis;
	}

	public void setSinopsis(String sinopsis) {
		this.sinopsis = sinopsis;
	}

	public String getTipoProyeccion() {
		return this.tipoProyeccion;
	}

	public void setTipoProyeccion(String tipoProyeccion) {
		this.tipoProyeccion = tipoProyeccion;
	}

	public String getTitulo() {
		return this.titulo;
	}

	public void setTitulo(String titulo) {
		this.titulo = titulo;
	}

	public byte getTresd() {
		return this.tresd;
	}

	public void setTresd(byte tresd) {
		this.tresd = tresd;
	}

	public String getWeb() {
		return this.web;
	}

	public void setWeb(String web) {
		this.web = web;
	}

//	public Set<Horario> getHorarios() {
//		return this.horarios;
//	}
//
//	public void setHorarios(Set<Horario> horarios) {
//		this.horarios = horarios;
//	}

	public void setHorarioCollection(Collection<Horario> horarioCollection) {
		this.horarioCollection = horarioCollection;
	}

	public Collection<Horario> getHorarioCollection() {
		return horarioCollection;
	}
	
	@Override
    public int hashCode() {
        int hash = 0;
        hash += (idPelicula != null ? idPelicula.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pelicula)) {
            return false;
        }
        Pelicula other = (Pelicula) object;
        if ((this.idPelicula == null && other.idPelicula != null) || (this.idPelicula != null && !this.idPelicula.equals(other.idPelicula))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cineplanet.modelo.Pelicula[idPelicula=" + idPelicula + "]";
    }

}